<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>Title</title>
    <style>
    </style>
    <%--<script src="https://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"></script>--%>
    <script src="${pageContext.request.contextPath}/static/js/jquery-3.3.1.min.js"></script>
    <script>
        $(function () {
           // $("a[id]").css({"color":"red","text-decoration":"underline"})
            // href="${pageContext.request.contextPath}/user/del/${user.id}"
           // alert("aaaaa")
            $(".delUser").click(function () {
                var id = $(this).attr("id");
                //todo 加一个confirm
                $(this).attr("href","${pageContext.request.contextPath}/user/del/"+id);
            });
        })
    </script>
</head>
<body>
    <table border="1px solid red" cellspacing="0" cellpadding="0">
        <tr>
            <td colspan="5">添加用户</td>
        </tr>
        <tr>
            <th>编号</th>
            <th>姓名</th>
            <th>地址</th>
            <th>年龄</th>
            <th>操作</th>
        </tr>
        <c:forEach items="${list}" var="user" varStatus="vs">
            <tr>
                <td>${vs.count}</td>
                <td>${user.name}</td>
                <td>${user.addr}</td>
                <td>${user.age}</td>
                <td>
                    <a href="${pageContext.request.contextPath}/user/toUppdate/${user.id}">修改</a>
                    <a class="delUser" id="${user.id}">删除</a>
                </td>
            </tr>
        </c:forEach>
    </table>
</body>
</html>
